//封装函数，实现扁平化
function flatten(arr){
    return arr.reduce((prev,cur)=>{
        return prev.concat(Array.isArray(cur)?flatten(cur):cur)
    },[])
}
let arr=[1,2,[3,4],[5,6],[6,7]];
console.log(flatten(arr))
//[1,2,3,4,5,6,6,7]